package Day019_Junit单元测试_NIO.ZuoYe;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * @author zhangyan
 * @date 2020/5/12 17:49
 */
public class Calcuate {

    Calcuate calcuate;
    @Before
    public void start(){
        calcuate = new Calcuate();
    }

    @After
    public void end(){
        calcuate = null;
    }

    @Test
    public void testAdd() {
        //调用add方法
        int  result = add(1, 2);
        //断言
        Assert.assertEquals(3,  result);

        System.out.println(" result=" +  result);
    }

    @Test
    public void testSubtract() {
        //调用subtract方法
        int result = subtract(9, 2);
        //断言
        Assert.assertEquals(7,  result);

        System.out.println(" result=" +  result);
    }

    @Test
    public void testMultiply() {
        //调用multiply方法
        int result = multiply(2, 3);
        //断言
        Assert.assertEquals(6,  result);

        System.out.println(" result=" +  result);
    }
    @Test
    public void testDivide() {
        //调用divide方法
        int result = divide(8, 2);
        //断言
        Assert.assertEquals(4,  result);

        System.out.println(" result=" +  result);
    }

    public int add(int a, int b) {
        return a + b;
    }

    public int subtract(int a, int b) {
        return a - b;
    }

    public int multiply(int a, int b) {
        return a * b;
    }

    public int divide(int a, int b) {
        return a / b;

    }
}